<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;

class CommonController extends Controller{
    public function upload(){
        $file = \Input::file('Filedata');
        if($file->isValid()){
            //$realPath = $file->getRealPath(); // 临时文件的绝对路径
            $extension = $file->getClientOriginalExtension();
            
            $newName = date('YmdHis').mt_rand(100, 999).'.'.$extension;
            $path = $file->move(base_path().'/uploads', $newName);
            $filepath = '/uploads/'.$newName;
            return $filepath;
        }
    }
}
